<div class="layout-content">
{if $action == "add"}
    <h1>Tworzenie nowej podstrony</h1>
{else}
    <h1>Edycja podstron </h1>
{/if}

{if !empty($content) || $action=="add"}
{if $action!="add"}
    <h2>Podstrona {$content.alias}</h2>
{else}
    {$content = [
        "alias"=>"",
        "id"=>0,
        "title"=>"",
        "special"=>"Nie",
        "view_template"=>"",
        "absolute_view"=>"0",        
        "background"=>"",
        "content"=>"",
        "effect_id"=>"0"]}
{/if}
</div>
<div class="layout-content">
    <div style="display:hidden" id="error"></div>
    <table>
        <thead>
            <tr>
                <td colspan="2" style="text-align: left;">Tabela edycji</td>                                            
            </tr>            
        </thead>        
        <tbody>
            <tr><td class="ep1">Alias<br/>{if $action=="add"}<font class="green_info"><b>Filtrowanie maski aliasu włączone.</b> </font>{/if}</td><td><input name="Alias" value="{$content.alias}" {if $smarty.session.PrivilageLevel!=1}readonly="readonly" {/if}type="text" class="button-field dark-field"/><input name="id" value="{$content.id}"  type="hidden"/>{if $action=="add"}<font class="green_info">Dozwolone znaki: duże i małe litery, cyfry oraz " - ", " _ "</font>{/if}</td></tr>
            <tr><td class="ep1">Tytuł</td><td><input  name="Title" value="{$content.title}" type="text" class="button-field dark-field"/></td></tr>
            <tr><td class="ep1">Podstrona specialna:</td><td>{$content.special}</td></tr>
           
            <tr><td class="ep1">Efekt przejścia:</td><td style="align: left;">
                <select name="Effect" class="button-field dark-field"style="float: left;">
                    <option value="0">Brak</option>
                    {foreach $effects item=e}
                        <option value="{$e.id}" {if $content.effect_id == $e.id} selected="selected"{/if}>{$e.action} {$e.direction}</option>
                    {/foreach}
                </select>
                </td></tr>
            <tr><td class="ep1">Tło podstrony:</td><td>            
            <select name="Background" class="button-field dark-field" style="float: left;">                
            {foreach $backgrounds item=k}
                <option value="{$k}" {if $k==$content.background}selected="selected"{/if}>{$k}</option>
            {/foreach}
            </select>
            </td></tr>
            <tr><td class="ep1">Widok jest absolutny:</td><td>
                <input name="AbsoluteView" type="radio" value="0" {if $content.absolute_view == "0"} checked="checked"{/if}/>Nie<br/>
            <!--    <input name="AbsoluteView" type="radio" value="1" {if $content.absolute_view == "1"} checked="checked"{/if}/>Tak//-->
            </td></tr>
            <tr><td class="ep1">Użyj widoku:</td><td>
            {*<input class="button-field dark-field" name="AssignedView" type="text" value="{$content.view_template}" style="float: left;"/>*}
            <select name="AssignedView" class="button-field dark-field" style="float: left;" >
            {if $smarty.session.PrivilageLevel==1}
                <option value=""></option>
            {foreach $templates item=k}
                <option value="{$k}" {if $k==$content.view_template}selected="selected"{/if}>{$k}</option>
            {/foreach}
            {else}
               <option value="{$content.view_template}" selected="selected">{$content.view_template}</option> 
             {/if}
            </select>
            </td></tr>
            
            <tr><td class="ep1" style="vertical-align: top;">Treść strony</td>
            <td><textarea name="Content" class="button-field-long dark-field"style="width: 500px;margin-left: 0px;">{$content.content}</textarea></td></tr>
        </tbody>
        <tfoot>
            <td colspan="2">
                <input onclick="Subpages.Cancel()" name="Cancel" value="Anuluj" class="red button" type="button"/ >
                <input style="float: right" onclick="Subpages.Setup()" name="Setup" value="Zastosuj" class="blue button" type="button"/>
                <input onclick="Subpages.SetupClose()" name="SetupClose" value="Zastosuj i Zamknij" class="dark button" type="button"/>
                <input name="Action" value="{$action}" type="hidden"/>
            </td>
         </tfoot>        
    </table>
</div>
{else}
    <div id="error"><p>Podstrona o wybranym identyfikatorze nie istnieje !</p></div>
{/if}